package com.phone.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name="cartitml")
public class CartItml {
	private Integer id;
	private String name; //名字
	private String description;//商品描述
    private String listimg; //图片名字显示
	private int price  ;  //价格
	private int count;  //商品的数量
	private int totalprice;//商品的总价
	private User user;//商品和用户是多对一
	public CartItml() {
		super();
	}
	public CartItml(Integer id, String name, String description, String listimg, int price,
			int count, int totalprice, User user) {
		super();
		this.id = id;
		this.name = name;
		this.description = description;
		this.listimg = listimg;
		this.price = price;
		this.count = count;
		this.totalprice = totalprice;
		this.user = user;
	}
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	@Column(name="name")
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}

	@Column(name="description")
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}

	@Column(name="listimg")
	public String getListimg() {
		return listimg;
	}
	public void setListimg(String listimg) {
		this.listimg = listimg;
	}

	@Column(name="price")
	public int getPrice() {
		return price;
	}
	public void setPrice(int price) {
		this.price = price;
	}
	@Column(name="count")
	public int getCount() {
		return count;
	}
	public void setCount(int count) {
		this.count = count;
	}
	@Column(name="totalprice")
	public int getTotalprice() {
		return totalprice;
	}
	public void setTotalprice(int totalprice) {
		this.totalprice = totalprice;
	}
	@ManyToOne
	@JoinColumn(name="uid")
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	@Override
	public String toString() {
		return "CartItml [id=" + id + ", name=" + name + ", description=" + description + ", listimg=" + listimg
				+ ", price=" + price + ", count=" + count + ", totalprice="
				+ totalprice + ", user=" + user + "]";
	}
	

}
